import httpInstance from "@/utils/http";

/**
 * 社团相关API服务
 */
export default {
  /**
   * 获取用户管理的社团列表
   * @param {String|Number} userId 用户ID
   * @returns {Promise} 获取社团列表的Promise
   */
  getManagedClubs(userId) {
    return httpInstance.get(`/api/club/managed?userId=${userId}`);
  },

  /**
   * 创建活动
   * @param {Object} activityData 活动数据
   * @returns {Promise} 创建活动的Promise
   */
  createActivity(activityData) {
    return httpInstance.post('/api/activity/create', activityData, {
      headers: {
        'Content-Type': 'application/json'
      }
    });
  },

  /**
   * 添加荣誉
   * @param {Object} achievementData 荣誉数据
   * @returns {Promise} 添加荣誉的Promise
   */
  createAchievement(achievementData) {
    return httpInstance.post('/api/achievement/create', achievementData, {
      headers: {
        'Content-Type': 'application/json'
      }
    });
  },

  /**
   * 更新社团招新状态
   * @param {String|Number} clubId 社团ID
   * @param {Number} status 招新状态 (1:招新中, 0:已停止招新)
   * @returns {Promise} 更新招新状态的Promise
   */
  updateRecruitmentStatus(clubId, status) {
    return httpInstance.post('/api/club/update/status', {
      clubId: clubId,
      status: status
    });
  },
  
  /**
   * 获取社团详情
   * @param {String|Number} clubId 社团ID
   * @returns {Promise} 获取社团详情的Promise
   */
  getClubDetail(clubId) {
    return httpInstance.get(`/api/club/detail/${clubId}`);
  },
  
  /**
   * 获取社团成员列表
   * @param {String|Number} clubId 社团ID
   * @returns {Promise} 获取社团成员列表的Promise
   */
  getClubMembers(clubId) {
    return httpInstance.get(`/api/club/members/${clubId}`);
  },
  
  /**
   * 获取社团活动列表
   * @param {String|Number} clubId 社团ID
   * @returns {Promise} 获取社团活动列表的Promise
   */
  getClubActivities(clubId) {
    return httpInstance.get(`/api/club/activities/${clubId}`);
  }
}; 